    	     <?
	     if($thumb==null):
                 foreach ($models as $value) {
	     	echo  '<img border=0 src="'.$imgurl.$value->$filder. '" width="'.$width.'"  height="'.$height.'" >';
                 }
	     else:
                 ?>
<SCRIPT LANGUAGE="JavaScript">
    w=Math.round((($(window).width()+640)/2))-640;
    h=Math.round((($(window).height()+480)/2))-480;
    

function new_window(url)
{
window.open(url,'фото','top='+h+', left='+w+', menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, width=640, height=480');
}

</SCRIPT>
<?php
                  foreach ($models as $value) {
                 ?> <a  onclick="new_window('<?php echo $imgurl.$value->$filder?>'); return false"   target="_blank" href="<?php echo $imgurl.$value->$filder?>"> <?php
	     	echo  '<img border=0 src="'.$imgurl.$thumb.$value->$filder. '" width="'.$width.'"  height="'.$height.'" >';
               ?>  </a> <?php
                 } 

		 endif;?>